<table cellspacing='1'
       cellpadding='1'
       onmouseover="$('new_stage_<%= stage.id %>_type_<%= type.id %>_work_item').show();" onmouseout="$('new_stage_<%= stage.id %>_type_<%= type.id %>_work_item').hide();">
  <tr>
    <th width="200">名称</th>
    <th width="50">单价</th>
    <th >备注</th>
    <th width="100">待发</th>
    <th class='hidden'>
      <div id='new_stage_<%= stage.id %>_type_<%= type.id %>_work_item' class='tools' style='display:none;'>
        <%= link_to_remote '▶创建',
                  :update => "stage_#{stage.id}_type_#{type.id}_work_items",
                  :url => new_work_item_url(
                  :stage_id => stage.id,
                  :work_item_type_id => type.id
                ),
                :method => :get,
                :complete => "Effect.BlindDown('stage_#{stage.id}_type_#{type.id}_work_items')",
                :html => {
                  :class => :base_i
                }
          %>
      </div>
    </th>
  </tr>
  <% WorkItem.find_all_by_stage_id_and_work_item_type_id(stage.id,type.id).each do |item| %>
    <tr onmouseover="$('item_tools_<%= item.id %>').show();" onmouseout="$('item_tools_<%= item.id %>').hide();">
      <td>
        <%= item.name %>
      </td>
      <td align='right'><%= item.pay_unit %></td>
      <td title="<%= item.remark %>"><%= truncate(h(item.remark), :length => 10) %></td>
      <td align='right' class='money'>￥<%= number_with_precision item.total_amount, :precision => 1 %></td>
      <td class='hidden'>
        <div id='item_tools_<%= item.id %>' style='display:none;'>
          <%= link_to_remote '修改',
                :update => "stage_#{stage.id}_type_#{type.id}_work_items",
                :url => edit_work_item_url(item),
              :method => :get,
              :complete => "Effect.BlindDown('stage_#{stage.id}_type_#{type.id}_work_items')",
              :html => {
                :class => :base_i
              }
            %>
          <%= link_to_remote '删除',
                :update => "stage_#{stage.id}_type_#{type.id}_work_items",
                :url => work_item_url(item),
                :method => :delete,
                :confirm => '确认要删除该项吗?',
                :html => {
                  :class => :base_i
                }
            %>
        </div>
      </td>
    </tr>
  <% end %>
  <tr>
    <td align='right' colspan='4' class='total' >合计：<b>￥<%= number_with_precision WorkItem.should_be_payed( :stage_id => stage.id, :work_item_type_id => type.id), :precision => 1 %></b></td>
    <td class='hidden'></td>
  </tr>
</table>